<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>

<link href="/css/index.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]>
<link href="/css/index-IE.css" rel="stylesheet" type="text/css">
<![endif]-->
<link href="/css/span.checkbox-class.css" rel="stylesheet" type="text/css">

</head>

<body>
<div align="center" TOP>
	<div>
	<span F-L LOGO>纯&nbsp;简</span>
	<a L href="/index">首页</a>
    <a R href="/login">登录</a>
    </div>
</div>

<div align="center" MAIN>
	<div>
	
<div TITLE>用户注册</div>
<form THIS action="/regsub" method="post">
<div align="left" M20 PL300>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EMAIL:<input type="email" name="email" I240 FOCUS autofocus><span ML20>用于登录</span><span email ML20></span><br><br>
&nbsp;&nbsp;&nbsp;USERNAME:<input type="text" name="username" I240 FOCUS><span ML20>个性的用户名称{长度：10个中文=20个英文字符}</span><span username ML20></span><br><br>
&nbsp;&nbsp;&nbsp;PASSWORD:<input type="password" name="password" I240 FOCUS><span ML20>登录密码{长度：6~20个英文字符}</span><span password ML20></span><br><br>
RE PASSWORD:<input type="password" name="repassword" I240 FOCUS><span ML20>注册时验证密码是否与登录密码一致</span><span repassword ML20></span><br>
</div>
<div align="center" M20  MIN-H130>
	<input type="submit" value="提交注册" I100 IBTN>
	
	<span class="checkbox1" id="che" checkbox><input type="checkbox"><span>&nbsp;&nbsp;</span></span>
	
	<span for="che">《使用协议》</span>
	<a href="/agreement.html" target="_blank" COLOR>[查看]</a><span deal ML20 style="visibility:hidden;">没有同意使用协议</span>
</div>
</form>

	</div>
</div>

<div align="center" FOOTER>
	<div>
    <span>联系方式：</span>
    <a QQ class="qq" href="http://wpa.qq.com/msgrd?v=3&uin=1083107312&site=qq&menu=yes" title="点击聊天">QQ: 1083107312</a>
    <a EMAIL class="email" href="mailto:Mr.Li.IT.7@gmail.com" title="点击发送邮件">Email: Mr.Li.IT.7@gmail.com</a>
    </div>
</div>

<script src="script/jquery-1.7.1.js"></script>
<script src="script/span.checkbox-class.js"></script>
<script type="text/javascript">

$("form[THIS]").submit(function(){
	var email = $("input[name='email']");
	var username = $("input[name='username']");
	var password = $("input[name='password']");
	var repassword = $("input[name='repassword']");
	
	if(email.val().trim() == ""){
		email.focus();
		$("span[email]").html("EMAIL不能为空！").css({color:"#F00"});
		return false;
	}else{
		$("span[email]").html("");
		email.val(email.val().trim());
	}
	
	var pattern = "\\b(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@([A-Za-z0-9-])+(\\.[A-Za-z0-9-]+)*((\\.[A-Za-z0-9]{2,})|(\\.[A-Za-z0-9]{2,}\\.[A-Za-z0-9]{2,}))$)\\b";
	var emailAddressPattern = new RegExp(pattern);
	if(!emailAddressPattern.test(email.val())){
		$("span[email]").html("EMAIL格式不正确！").css({color:"#F00"});
		return false;
	}else{
		$("span[email]").html("");
	}
	
	if(username.val().trim() == ""){
		$("span[username]").html("USERNAME不能为空！").css({color:"#F00"});
		username.focus();
		return false;
	}else{
		$("span[username]").html("");
		username.val(username.val().trim());
	}

	if(password.val().trim() == ""){
		$("span[password]").html("PASSWORD不能为空！").css({color:"#F00"});
		password.focus();
		return false;
	}else{
		$("span[password]").html("");
		password.val(password.val().trim());
	}
	
	var passwordPattern = new RegExp("\\w{6,20}");
	if(!passwordPattern.test(password.val())){
		$("span[password]").html("密码格式不正确！").css({color:"#F00"});
		password.focus();
		return false;
	}else{
		$("span[password]").html("");
	}
	
	if(repassword.val().trim() == ""){
		$("span[repassword]").html("请输入RE PASSWORD！").css({color:"#F00"});
		repassword.focus();
		return false;
	}else{
		$("span[repassword]").html("");
		repassword.val(repassword.val().trim());
	}
	
	if(repassword.val() != password.val()){
		$("span[repassword]").html("RE PASSWORD与PASSWORD不一致！").css({color:"#F00"});
		repassword.focus();
		return false;
	}else{
		$("span[repassword]").html("");
	}
	
	var checkbox = $("input[type='checkbox']");
	if(checkbox.attr("checked") != "checked"){
		$("span[deal]").css({visibility:"visible", color:"#F00"});
		return false;
	}else{
		$("span[deal]").css({visibility:"hidden"});
	}
	
	return true;
});


</script>

</body>
</html>
